<template>
    <div style="height: 100%; width: 100%; position: relative">
        <div :class="!is_showselother ? 'pagetop' : 'pagetopother'">
            <div style="height: 100%">
                <table border="0" style="width: 100%; font-size: 12px; width: 100%; white-space: nowrap" class="table1style">
                    <col style="width: 5%" />
                    <col style="width: 11%" />
                    <col style="width: 1%" />
                    <col style="width: 11%" />
                    <col style="width: 5%" />
                    <col style="width: 11%" />
                    <col style="width: 5%" />
                    <col style="width: 9%" />
                    <col style="width: 5%" />
                    <col style="width: 9%" />
                    <col style="width: 5%" />
                    <col style="width: 9%" />
                    <col style="width: 5%" />
                    <col style="width: 9%" />
                    <tr>
                        <td align="right">
                            <el-dropdown @command="handleCommand" style="font-size: 12px">
                                <u class="el-dropdown-link">
                                    {{ datename }}
                                </u>
                                <el-dropdown-menu slot="dropdown">
                                    <el-dropdown-item command="标本日期">
                                        <font font-size="12px">标本日期</font>
                                    </el-dropdown-item>
                                    <el-dropdown-item command="报告日期">
                                        <font font-size="12px">报告日期</font>
                                    </el-dropdown-item>
                                </el-dropdown-menu>
                            </el-dropdown>
                        </td>
                        <td>
                            <el-date-picker v-model="searchobj.strdate" :clearable="false" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%"> </el-date-picker>
                        </td>
                        <td>至</td>
                        <td>
                            <el-date-picker v-model="searchobj.enddate" type="date" :clearable="false" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%"> </el-date-picker>
                        </td>
                        <td align="right">报告单元</td>
                        <td>
                            <rm-ddl-rptunit prgno="LIS971" :clearable="false" defaultflag="" v-model="searchobj.rptunitid" width="100%" key="1"></rm-ddl-rptunit>
                        </td>
                        <td align="right">申请科室</td>
                        <td>
                            <el-select v-model="searchobj.reqdept" @dblclick.native="popMultipleChk(searchobj.reqdept, 'reqdept', deptOption, '申请科室选择')" filterable clearable>
                                <el-option v-for="(item, index) in deptOption" :key="index" :value="item.data" :label="item.display"> </el-option>
                            </el-select>
                        </td>
                        <td align="right">标本类型</td>
                        <td>
                            <el-select v-model="searchobj.txtspecimen" @dblclick.native="popMultipleChk(txtspecimen, 'txtspecimen', specimenOption, '标本类型选择')" filterable clearable>
                                <el-option v-for="(item, index) in specimenOption" :key="index" :value="item.data" :label="item.display"> </el-option>
                            </el-select>
                        </td>
                        <td align="right">导出条件</td>
                        <td>
                            <el-popover width="500px" trigger="click" placement="bottom" v-model="exportConditionVisible">
                                <div style="height: 300px; width: 500px">
                                    <div style="width: 95%; float: left; margin: 10px">
                                        <el-divider content-position="left">导出要求</el-divider>
                                        <table>
                                            <tr>
                                                <td>
                                                    <el-checkbox true-label="1" false-label="0" v-model="exportobj.PatnoShowPatid">病人号显示病人ID</el-checkbox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <el-checkbox true-label="1" false-label="0" v-model="exportobj.micIsEmptyNouseResultFlag">Mic为空不使用结果标志代替</el-checkbox>
                                                </td>
                                                <td>
                                                    <el-checkbox true-label="1" false-label="0" v-model="exportobj.OnlyMicNotEmpty">仅导出Mic不为空的数据</el-checkbox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <el-checkbox true-label="1" false-label="0" v-model="exportobj.radIsEmptyNouseResultFlag">Rad为空不使用结果标志代替</el-checkbox>
                                                </td>
                                                <td>
                                                    <el-checkbox true-label="1" false-label="0" v-model="exportobj.OnlyRadNotEmpty">仅导出Rad不为空的数据</el-checkbox>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div style="width: 95%; float: left; margin: 10px">
                                        <el-divider content-position="left">导出时剔除药敏结果中的以下符号</el-divider>
                                        <table>
                                            <tr>
                                                <td>
                                                    <el-checkbox v-model="exportobj.chkdayu" true-label="1" false-label="0">&gt;</el-checkbox>
                                                    <el-checkbox v-model="exportobj.chkxiaoyu" true-label="1" false-label="0">&lt;</el-checkbox>
                                                    <el-checkbox v-model="exportobj.chkdayudengyu" true-label="1" false-label="0">&gt;=</el-checkbox>
                                                    <el-checkbox v-model="exportobj.chkxiaoyudengyu" true-label="1" false-label="0">&lt;=</el-checkbox>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div style="width: 95%; float: left; margin: 10px">
                                        <el-divider content-position="left">导出时小数点处理</el-divider>
                                        <table>
                                            <tr>
                                                <td>
                                                    <label>保留小数位：</label>
                                                    <el-select v-model="exportobj.numbernum" placeholder="请选择" style="width:105px">
                                                        <el-option label="0" value="4"></el-option>
                                                        <el-option label="1" value="1"></el-option>
                                                        <el-option label="2" value="2"></el-option>
                                                        <el-option label="3" value="3"></el-option>
                                                    </el-select>
                                                    <label style="margin-left: 15px;">取整方式：</label>
                                                    <el-select v-model="exportobj.numbermth" placeholder="请选择" style="width:105px">
                                                        <el-option label="四舍五入" value="0"></el-option>
                                                        <el-option label="向上取整" value="1"></el-option>
                                                        <el-option label="向下取整" value="2"></el-option>
                                                    </el-select>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div style="width: 95%; float: left; margin: 10px">
                                        <el-divider content-position="left">导出时药敏结果中"/"处理公式设置(参照计算公式函数说明文档)</el-divider>
                                        <table>
                                            <tr>
                                                <td>
                                                    <label>公式设置：</label>
                                                    <el-input v-model="exportobj.slashformula"  style="width: 350px"></el-input>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div style="width: 95%; float: left; margin: 10px">
                                        <el-divider content-position="left">SYN-R/SYN-S转换</el-divider>
                                        <table>
                                            <tr>
                                                <td>
                                                    <el-checkbox v-model="exportobj.chksynr" true-label="1" false-label="0">SYN-R导出：高浓度庆大霉素&gt;=1000；高浓度链霉素&gt;=2000</el-checkbox>
                                                    <el-checkbox v-model="exportobj.chksyns" true-label="1" false-label="0">SYN-S导出：高浓度庆大霉素&lt;=500；高浓度链霉素&lt;=1000</el-checkbox>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div style="width: 95%; float: left; margin: 10px">
                                        <el-button @click.native="ExportConditionSure">确定</el-button>
                                        <el-button @click.native="ExportConditionClear">清除</el-button>
                                        <el-button @click.native="exportConditionVisible = false">取消</el-button>
                                    </div>
                                </div>
                                <el-input slot="reference" style="width: 160px; cursor: pointer" readonly placeholder="点击展开导出条件" clearable></el-input>
                            </el-popover>
                        </td>
                        <td colspan="2" align="center">
                            <el-link :underline="false" @click="btn_showselother">{{ is_showselother ? "收起其它条件" : "展开其它条件" }}<i :class="is_showselother ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"></i> </el-link>
                        </td>
                    </tr>
                    <tr v-show="is_showselother">
                        <td align="right">标本号</td>
                        <td colspan="3">
                            <el-input v-model="searchobj.txtbarcode" @keyup.enter.native="FunQuery" style="width: 100%"></el-input>
                        </td>
                        <td align="right">检验仪器</td>
                        <td>
                            <rm-ddl-instrument v-model="searchobj.txtlabinstrument" width="100%" :clearable="true"></rm-ddl-instrument>
                        </td>
                        <td align="right">病历号</td>
                        <td>
                            <el-input v-model="searchobj.patno" clearable></el-input>
                        </td>
                        <td align="right">病人姓名</td>
                        <td>
                            <el-input v-model="searchobj.txtpatname" @keyup.enter.native="FunQuery" style="width: 100%"></el-input>
                        </td>
                        <td align="right">病人来源</td>
                        <td>
                            <el-select v-model="searchobj.pattype" @dblclick.native="popMultipleChk(searchobj.pattype, 'pattype', pattypeOption, '病人来源')" filterable clearable>
                                <el-option v-for="(item, index) in pattypeOption" :key="index" :value="item.data" :label="item.display"> </el-option>
                            </el-select>
                            <!-- <rm-ddl-common datatype="seccode" kindno="PT" dataname="病人来源" v-model="searchobj.pattype" width="100%"></rm-ddl-common> -->
                        </td>
                        <td align="right">科室取值</td>
                        <td>
                            <el-select v-model="searchobj.deptmode">
                                <el-option v-for="(item, index) in deptmodeOption" :key="index" :label="item.label" :value="item.value"></el-option>
                            </el-select>
                        </td>
                    </tr>
                    <tr v-show="is_showselother">
                        <td align="right">送检医院</td>
                        <td colspan="3">
                            <table style="border-spacing: 0px">
                                <tr>
                                    <td>
                                        <rm-ddl-common datatype="hospital" dataname="医院" v-model="searchobj.hospcode" width="100%"></rm-ddl-common>
                                    </td>
                                    <td>
                                        &nbsp; <el-checkbox true-label="1" false-label="0" v-model="searchobj.containHospcodeIsEmpty"><span style="font-size: 12px">包含送检院区为空的</span></el-checkbox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td align="right">所属病区</td>
                        <td>
                            <el-select v-model="searchobj.txtwardno" @dblclick.native="popMultipleChk(searchobj.txtwardno, 'txtwardno', wardOption, '病区选择')" filterable clearable>
                                <el-option v-for="(item, index) in wardOption" :key="index" :value="item.data" :label="item.display"> </el-option>
                            </el-select>
                        </td>
                        <td align="right">细菌组合</td>
                        <td colspan="3">
                            <table style="border-spacing: 0px">
                                <tr>
                                    <td>
                                        <el-select v-model="searchobj.germcomb" @dblclick.native="popMultipleChk(searchobj.germcomb, 'germcomb', germcombOption, '细菌组')" filterable clearable>
                                            <el-option v-for="(item, index) in germcombOption" :key="index" :value="item.data" :label="item.display"> </el-option>
                                        </el-select>
                                    </td>
                                    <td>&nbsp;</td>
                                    <td>
                                        <el-checkbox true-label="1" false-label="0" v-model="searchobj.rejectGermComb"><span style="font-size: 12px">剔除菌组</span></el-checkbox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td align="right">耐药机制</td>
                        <td>
                            <rm-ddl-common datatype="resdict" dataname="耐药机制" v-model="searchobj.txtrescode" width="100%"></rm-ddl-common>
                        </td>
                        <td colspan="2" align="right">
                            <el-checkbox true-label="1" false-label="0" v-model="exportobj.delCopySample">剔除复制标本</el-checkbox>
                        </td>
                    </tr>
                    <tr v-show="is_showselother">
                        <td align="right">真菌标志</td>
                        <td>
                            <el-select v-model="searchobj.germgramflag">
                                <el-option value="0" label="全部"></el-option>
                                <el-option value="1" label="真菌"></el-option>
                                <el-option value="2" label="细菌"></el-option>
                            </el-select>
                        </td>
                        <td align="right">实验室代码</td>
                        <td>
                            <el-input v-model="searchobj.laboratory" style="width: 100%"></el-input>
                        </td>
                        <td colspan="3" align="center">
                            <el-radio-group v-model="searchobj.onlyposresult">
                                <el-radio :label="0">全部</el-radio>
                                <el-radio :label="1">阳性菌</el-radio>
                                <el-radio :label="2">带药敏</el-radio>
                                <el-radio :label="3">剔除涂片</el-radio>
                            </el-radio-group>
                        </td>
                        <td></td>
                        <td colspan="6" align="center">
                            <el-radio-group v-model="searchobj.deletedup">
                                <el-radio :label="1">去除同一个病人的相同结果</el-radio>
                                <el-radio :label="2">去除同一个病人同标本类型的相同结果</el-radio>
                                <el-radio :label="0">不去除</el-radio>
                            </el-radio-group>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="14" align="right">
                            <el-button @click.native="BtnQuery" type="primary" icon="el-icon-search" v-has="'PINQUERY'">查询</el-button>
                            <!-- <el-button @click.native="BtnSort" icon="el-icon-edit-outline">排序</el-button> -->
                            <el-button @click.native="BtnClear" icon="el-icon-close">清除</el-button>
                            <!-- <el-button @click.native="BtnPrint" icon="el-icon-printer">打印</el-button> -->
                            <el-button @click.native="BtnExport" icon="el-icon-download">导出</el-button>
                            <el-button slot="reference" icon="el-icon-download" @click="BtnDbf">DBF导出</el-button>
                            <el-button @click.native="getwhonetcheck()" icon="el-icon-check">whonet对照</el-button>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div :class="!is_showselother ? 'pagecenter' : 'pagecenterother'">
            <rm-layout-right splitcolor="white" movingcolor="#0000ff" :splitwidth="5" :fixsize="400">
                <template v-slot:fix>
                    <div v-if="execexport" style="overflow:hidden;">
                        <el-button @click.native="stopexport" class="el-button--310" icon="el-icon-video-pause">停止导出</el-button>
                        <div style="height:100%;overflow:auto;">
                            <div ref="exportmsgdivref" id="exportmsgdiv" style="height:auto; width:100%;overflow:hidden;" v-html="logListstr">
                            </div>
                        </div>
                    </div>
                    <vxe-table v-else :data.sync="rightTableData" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" border height="auto" highlight-current-row class="mytable-style" highlight-hover-column highlight-hover-row how-header-overflow ref="rightxTable" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{ animat: false }" header-align="center" :loading="rightloading">
                        <vxe-table-column type="index" title="NO." width="40" align="center"></vxe-table-column>
                        <vxe-table-column field="medname" sortable title="抗生素" width="120"></vxe-table-column>
                        <vxe-table-column field="rad" sortable title="Rad" width="60" align="center"></vxe-table-column>
                        <vxe-table-column field="mic" sortable title="Mic" width="60" align="center"></vxe-table-column>
                        <vxe-table-column field="medresult" sortable title="药敏结果" width="60" align="center"></vxe-table-column>
                        <vxe-table-column field="result_flag" sortable title="标志" width="40" align="center"></vxe-table-column>
                        <vxe-table-column field="result6" sortable title="参考范围" width="70"></vxe-table-column>
                        <vxe-table-column field="expertresult" sortable title="专家值" width="60" align="center"></vxe-table-column>
                        <vxe-table-column field="medgroup" sortable title="分组" width="60" align="center"></vxe-table-column>
                        <vxe-table-column field="whonetcolidx" sortable title="导出列" width="60" align="center"></vxe-table-column>
                    </vxe-table>
                </template>
                <div style="height: 100%; width: 100%">
                    <vxe-table :data.sync="leftTableData" :select-config="{ reserve: true, checkAll: true }" :sort-config="{ trigger: 'cell' }" border height="auto" highlight-current-row class="mytable-style" highlight-hover-column highlight-hover-row how-header-overflow ref="leftxTable" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{ animat: false }" header-align="center" :loading="leftloading" @current-change="currentChangeEvent" :edit-config="{ trigger: 'click', mode: 'cell', activeMethod: CellActive, showStatus: true, showIcon: false }">
                        <vxe-table-column type="selection" width="40" align="center"> </vxe-table-column>
                        <vxe-table-column field="rechkflag" sortable title="审核" width="40" align="center">
                            <template v-slot="{ row }">
                                <span style="font-size: 16px; color: blue">{{ row.rechkflag == "9" ? "审" : "" }}</span>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="rptunitid" sortable title="报告单元" width="120" :formatter="formatFun"></vxe-table-column>
                        <vxe-table-column field="sampledate" sortable title="标本日期" width="80" align="center" :formatter="['toDateString', 'yyyy-MM-dd']"></vxe-table-column>
                        <vxe-table-column field="sampleno" sortable title="标本编号" width="80" align="center"></vxe-table-column>
                        <vxe-table-column field="pat_name" sortable title="姓名" width="50" align="center"></vxe-table-column>
                        <vxe-table-column field="pat_no" sortable title="病人号" width="70"></vxe-table-column>
                        <vxe-table-column field="pat_sex" sortable title="性别" width="40" align="center" :edit-render="{ name: 'select', options: $opt.patSex }"></vxe-table-column>
                        <vxe-table-column field="pat_agestr" sortable title="年龄" width="50" align="center"></vxe-table-column>
                        <vxe-table-column field="specimen_code" sortable title="标本类型" width="80" align="center" :formatter="formatFun"></vxe-table-column>
                        <vxe-table-column field="rpt_itemcode" sortable title="项目代码" width="80"></vxe-table-column>
                        <vxe-table-column field="rpt_itemname" sortable title="培养结果/检验项目" width="150"></vxe-table-column>
                        <vxe-table-column field="result_str" sortable title="检验结果" width="80" align="center"></vxe-table-column>
                        <vxe-table-column field="result1" sortable title="菌落计数" width="70" align="center"></vxe-table-column>
                        <vxe-table-column field="result4" sortable title="耐药机制" width="70"></vxe-table-column>
                        <vxe-table-column field="instrid" sortable title="检验仪器" width="80" align="center" :formatter="formatFun"></vxe-table-column>
                        <vxe-table-column field="result2" sortable title="特殊结果2" width="80" align="center"></vxe-table-column>
                        <vxe-table-column field="req_deptno" sortable title="申请科室" width="100" :formatter="formatFun"></vxe-table-column>
                        <vxe-table-column field="req_bedno" sortable title="床号" width="60" align="center"></vxe-table-column>
                        <vxe-table-column field="barcode" sortable title="条码号" width="90" align="center"></vxe-table-column>
                        <vxe-table-column field="rechk_dt" sortable title="审核时间" width="120" align="center"></vxe-table-column>
                        <vxe-table-column field="rechk_user" sortable title="审核医生" width="70" align="center" :formatter="formatFun"></vxe-table-column>
                        <vxe-table-column field="pat_typecode" sortable title="病人类别" width="60" align="center" :formatter="formatFun"></vxe-table-column>
                        <vxe-table-column field="req_wardno" sortable title="病人病区" width="90" :formatter="formatFun"></vxe-table-column>
                        <vxe-table-column field="result_txt" sortable title="专家评语" width="90" align="center"></vxe-table-column>
                        <!-- <vxe-table-column field="result3" sortable title="药敏组" width="90" align="center"></vxe-table-column>
                        <vxe-table-column field="alter_flag" sortable title="警告" width="40" align="center">
                            <template v-slot="{ row }">
                                <span style="color: blue; font-size: 16px">{{ row.alter_flag == "1" ? "警" : "" }}</span>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="emer_flag" sortable title="加急" width="40" align="center">
                            <template v-slot="{ row }">
                                <span style="color: red; font-size: 16px">{{ row.emer_flag == "1" ? "急" : "" }}</span>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="redo_flag" sortable title="复查" width="40" align="center">
                            <template v-slot="{ row }">
                                <span style="color: green; font-size: 16px">{{ row.redo_flag == "1" ? "复" : "" }}</span>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="print_count" sortable title="打印次数" width="60" align="center"></vxe-table-column>
                        <vxe-table-column field="charge_typeno" sortable title="收费类别" width="90"></vxe-table-column>
                        <vxe-table-column field="pat_diag" sortable title="临床诊断" width="90"></vxe-table-column>
                        <vxe-table-column field="req_dt" sortable title="申请时间" width="120" align="center"></vxe-table-column>
                        <vxe-table-column field="req_docno" sortable title="申请医生" width="70" align="center" :formatter="formatFun"></vxe-table-column>
                        <vxe-table-column field="sampled_dt" sortable title="采样时间" width="120"></vxe-table-column>
                        <vxe-table-column field="recieve_dt" sortable title="接收时间" width="120" align="center"></vxe-table-column>
                        <vxe-table-column field="input_dt" sortable title="录入时间" width="120" align="center"></vxe-table-column>
                        <vxe-table-column field="test_info" sortable title="上机信息" width="90" align="center"></vxe-table-column>
                        <vxe-table-column field="test_dt" sortable title="上机时间" width="120"></vxe-table-column>
                        <vxe-table-column field="report_dt" sortable title="报告时间" width="120" align="center"></vxe-table-column>
                        <vxe-table-column field="report_user" sortable title="检验医生姓名" width="90" align="center"></vxe-table-column>
                        <vxe-table-column field="report_comm" sortable title="报告单备注" width="100" align="center"></vxe-table-column>
                        <vxe-table-column field="lab_advice" sortable title="实验室意见" width="100"></vxe-table-column>
                        <vxe-table-column field="item_num" sortable title="项目数" width="60" align="center"></vxe-table-column>
                        <vxe-table-column field="instr_advice" sortable title="仪器辅助诊断" width="100" align="center"></vxe-table-column>
                        <vxe-table-column field="rechk2_dt" sortable title="二审时间" width="120" align="center"></vxe-table-column>
                        <vxe-table-column field="rechk2_user" sortable title="二审医生" width="60" align="center" :formatter="formatFun"></vxe-table-column>
                        <vxe-table-column field="lastprint_dt" sortable title="最后打印时间" width="120" align="center"></vxe-table-column>
                        <vxe-table-column field="charge_flag" sortable title="计价" width="50" align="center" :edit-render="{ name: 'select', options: $opt.chargeOption }"></vxe-table-column>
                        <vxe-table-column field="prereport_dt" sortable title="预报告时间" width="120" align="center"></vxe-table-column>
                        <vxe-table-column field="reportid" sortable title="报告ID" width="120"></vxe-table-column>
                        <vxe-table-column field="hospcode" sortable title="医院" width="120" align="center" :formatter="formatFun"></vxe-table-column>
                        <vxe-table-column field="specimen_comm" sortable title="标本状态备注" width="80" align="center"></vxe-table-column>
                        <vxe-table-column field="req_id" sortable title="申请单ID" width="80" align="center"></vxe-table-column>
                        <vxe-table-column field="pat_cardno" sortable title="就诊卡号" width="100"></vxe-table-column>
                        <vxe-table-column field="inp_id" sortable title="就诊号" width="100" align="center"></vxe-table-column>
                        <vxe-table-column field="inp_date" sortable title="入院日期" width="120" align="center"></vxe-table-column>
                        <vxe-table-column field="pat_phone" sortable title="联系电话" width="80" align="center"></vxe-table-column>
                        <vxe-table-column field="pat_id" sortable title="病人ID" width="100"></vxe-table-column>
                         <vxe-table-column field="lastmodify_dt" sortable title="最后修改时间" width="120" align="center"></vxe-table-column>
                        <vxe-table-column field="release_dt" sortable title="发布时间" width="120" align="center"></vxe-table-column>
                        <vxe-table-column field="release_user" sortable title="发布人" width="70" align="center" :formatter="formatFun"></vxe-table-column>
                        <vxe-table-column field="req_reason" sortable title="送检目的" width="120"></vxe-table-column>
                        <vxe-table-column field="is_changed" sortable title="是否修改" width="70" align="center"></vxe-table-column>
                        <vxe-table-column field="changed_afterreport" sortable title="打印、审核后修改" width="100" align="center"></vxe-table-column>
                        <vxe-table-column field="unprint_flag" sortable title="禁止打印标志" width="100" align="center"></vxe-table-column>
                        <vxe-table-column field="unprint_reason" sortable title="禁止打印原因" width="100" align="center"></vxe-table-column> -->
                        <template v-slot:fix>
                            <div style="font-size: 17px; text-align: center; background-color: #fff; color: blue">
                                <span>共{{ rowcount }}行</span>
                            </div>
                        </template>
                    </vxe-table>
                </div>
            </rm-layout-right>
            <el-dialog title="上传DBF模板" :visible.sync="bDbfExportVisible" width="30%" height="300px">
                <el-upload :action="url" accept=".dbf" :before-upload="beforeUploadFile" :show-file-list="showFile" :file-list="fileList" :data="updata" :http-request="uploadOpt" class="upload-demo" multiple>
                    <div slot="tip" class="el-upload__tip">上传dbf文件，获取导出格式。</div>
                    <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
            </el-dialog>
            <el-dialog title="提示" :visible.sync="bMsgExportVisible" width="30%" height="300px">
                <span>{{DbfExportdefaultmsg}}</span>
                <span slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="BtnDBFExport()">确 定</el-button>
                    <el-button @click="bMsgExportVisible = false; bDbfExportVisible = true;">{{DbfExportbtnname}}</el-button>
                    <el-button @click="bMsgExportVisible = false">取 消</el-button>
                </span>
            </el-dialog>
            <el-dialog title="dbf导出结果" :visible.sync="bShowlogVisible" width="750px" height="500px" :append-to-body="true" :close-on-click-modal="false">
                <div style="width: 100%; height: 500px">

                    <!-- <div style="overflow-x: auto; overflow-y: auto; width: 100%; float: left; height: calc(100% - 30px); border: 1px solid #ccc">
                        <template>
                            <div style="over-flow: scroll">
                                <h3 v-for="msg in logList" :key="msg" style="color: black; font-size: 11px">{{ msg }}</h3>

                            </div>
                        </template>

                    </div> -->
                    <!-- <span style="height:30px;width::100%; padding:10px 20px 10px 0;text-align: right;box-sizing: border-box;">
                        <el-button style="float: right" type="primary" @click="bShowlogVisible = false">确 定 </el-button>
                    </span> -->
                </div>
            </el-dialog>
            <el-dialog title="WHONET对照" width="750px" :visible.sync="whonetVisible">
                <div style="height:500px;position:relative;width:100%">
                    <div class="diapagetop">
                        <table style="font-size:12px;width:100%" class="table1style">
                            <tr>
                                <td align="center">快速检索</td>
                                <td>
                                    <el-input placeholder="快速检索" prefix-icon="el-icon-search" ref="qcodeinput" style="width:260px;" v-model="searchtxt"></el-input>
                                </td>
                                <td>
                                    <el-button :disabled="onekeywhonet" @click="changewhonet('0')">一键对照whonet</el-button>
                                    <el-button :disabled="onekeywhonet" @click="changewhonet('1')">一键覆盖whonet</el-button>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <el-tabs style="height:470px;width:100%;position:relative" type="border-card" @tab-click="tab_getdata" v-model="tab_showflag" class="righttablist">
                        <el-tab-pane label="科室" name="tab_dept">
                            <vxe-table :data.sync="deptlist" :loading="tab_dept_loading" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="auto" class="mytablestyle" highlight-current-row highlight-hover-column highlight-hover-row ref="tab_dept_Table" show-overflow size="mini" stripe show-header-overflow :optimization="{animat: false}" resizable :edit-config="{trigger: 'click', mode: 'cell',showStatus:true}" header-align="center">
                                <vxe-table-column key="deptname" field="deptname" title="科室代码/名称" width="150px">
                                </vxe-table-column>
                                <vxe-table-column key="whocode" field="whocode" title="whonet代码" width="140px" :edit-render="{name: 'input', autoselect:true}">
                                    <template v-slot:edit="{row}">
                                        <rm-selecttable ref="tablereqselect" :currentLable="row.label" showName="label" :tableColumnData="allReqsheetTable" :ftableDataList="whonetdeptOption" :filterColumn="filterColumn" @change="deptchangewhocode($event, row)"></rm-selecttable>
                                    </template>
                                    <template v-slot="{row}">
                                        <span>{{!row.whocodename && !row.whocode ? '' : (!row.whocodename ? '' : row.whocodename) +'('+row.whocode+')'}}</span>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column key="whokind" field="whokind" title="whonet类别代码" width="140px" :edit-render="{name: 'input', autoselect:true}">
                                    <template v-slot:edit="{row}">
                                        <rm-selecttable ref="tablereqselect" :currentLable="row.label" showName="label" :tableColumnData="allReqsheetTable" :ftableDataList="whonetdepttypeOption" :filterColumn="filterColumn" @change="deptkindchangewhocode($event, row)"></rm-selecttable>
                                    </template>
                                    <template v-slot="{row}">
                                        <span>{{!row.whokindname && !row.whokind ? '' : (!row.whokindname ? '' : row.whokindname) +'('+row.whokind+')'}}</span>
                                    </template>
                                </vxe-table-column>
                            </vxe-table>
                        </el-tab-pane>
                        <el-tab-pane label="病区" name="tab_ward">
                            <vxe-table ref="tab_ward_Table" :data.sync="wardlist" :loading="tab_ward_loading" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}"
                                class="mytablestyle" highlight-current-row highlight-hover-column highlight-hover-row show-overflow size="mini" stripe border height="auto"
                                show-header-overflow :optimization="{animat: false}" resizable :edit-config="{trigger: 'click', mode: 'cell',showStatus:true}" header-align="center">
                                <vxe-table-column field="wardname" title="病区代码/名称" width="150px"></vxe-table-column>
                                <vxe-table-column field="whocode" title="whonet代码" width="140px" :edit-render="{name: 'input', autoselect:true}">
                                    <template v-slot:edit="{row}">
                                        <rm-selecttable ref="tablereqselect" :currentLable="row.label" showName="label" :tableColumnData="allReqsheetTable" :ftableDataList="whonetdeptOption" :filterColumn="filterColumn" @change="deptchangewhocode($event, row)"></rm-selecttable>
                                    </template>
                                    <template v-slot="{row}">
                                        <span>{{!row.whocodename && !row.whocode ? '' : (!row.whocodename ? '' : row.whocodename) +'('+row.whocode+')'}}</span>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column field="whokind" title="whonet类别代码" width="140px" :edit-render="{name: 'input', autoselect:true}">
                                    <template v-slot:edit="{row}">
                                        <rm-selecttable ref="tablereqselect" :currentLable="row.label" showName="label" :tableColumnData="allReqsheetTable" :ftableDataList="whonetdepttypeOption" :filterColumn="filterColumn" @change="deptkindchangewhocode($event, row)"></rm-selecttable>
                                    </template>
                                    <template v-slot="{row}">
                                        <span>{{!row.whokindname && !row.whokind ? '' : (!row.whokindname ? '' : row.whokindname) +'('+row.whokind+')'}}</span>
                                    </template>
                                </vxe-table-column>
                            </vxe-table>
                        </el-tab-pane>
                        <el-tab-pane label="标本类型" name="tab_spectype">
                            <vxe-table :data.sync="spectypelist" :loading="tab_spectype_loading" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="auto" class="mytablestyle" highlight-current-row highlight-hover-column highlight-hover-row ref="tab_spectype_Table" show-overflow size="mini" stripe show-header-overflow :optimization="{animat: false}" resizable :edit-config="{trigger: 'click', mode: 'cell',showStatus:true}" header-align="center">
                                <vxe-table-column key="specimen_name" field="specimen_name" title="标本类型" width="120px"></vxe-table-column>
                                <vxe-table-column key="whocode" field="whocode" title="whonet英文代码" width="140px" :edit-render="{name: 'input', autoselect:true}">
                                    <template v-slot:edit="{row}">
                                        <rm-selecttable ref="tablereqselect" :currentLable="row.label" showName="label" :tableColumnData="specallReqsheetTable" :ftableDataList="whonetspecimenOption" :filterColumn="filterColumn" @change="specimenchangewhocode($event, row)"></rm-selecttable>
                                    </template>
                                    <template v-slot="{row}">
                                        <span>{{!row.whocodename && !row.whocode ? '' : (!row.whocodename ? '' : row.whocodename) +'('+row.whocode+')'}}</span>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column key="whona" field="whona" title="数字代码" width="120px"></vxe-table-column>
                            </vxe-table>
                        </el-tab-pane>
                        <el-tab-pane label="细菌" name="tab_germ">
                            <!--排斥项目-->
                            <vxe-table :data.sync="germlist" :loading="tab_germ_loading" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="auto" class="mytablestyle" highlight-current-row highlight-hover-column highlight-hover-row ref="tab_germ_Table" show-overflow size="mini" stripe show-header-overflow :optimization="{animat: false}" resizable :edit-config="{trigger: 'click', mode: 'cell',showStatus:true}" header-align="center">
                                <vxe-table-column field="rpt_itemname" title="细菌" width="100px">
                                </vxe-table-column>
                                <!-- <vxe-table-column field="alertkingd" title="类型" width="100px">
                                </vxe-table-column> -->
                                <vxe-table-column field="itemcode_en" title="英文代码" width="100px">
                                </vxe-table-column>
                                <vxe-table-column field="germwhocode" title="whonet代码" width="140px" :edit-render="{name: 'input', autoselect:true}">
                                    <template v-slot:edit="{ row,rowIndex,column}">
                                        <el-input v-model="row.germwhocode" @keyup.down.native="
															ResultMove(tab_name,row, 1, rowIndex,column.property)
														" @keyup.up.native="
															ResultMove(tab_name,row, 0, rowIndex,column.property)
														" @keyup.enter.native="
															ResultMove(tab_name,row, 2, rowIndex,column.property)
														" class="marrow-input" style="width:100%;height:100%;" @change="hasChange(row)"></el-input>
                                    </template>
                                    <template v-slot="{row}">
                                        <span>{{row.germwhocode=='' || row.germwhocode==null?'':row.germwhocode}}</span>
                                    </template>
                                </vxe-table-column>
                            </vxe-table>
                        </el-tab-pane>
                        <el-tab-pane label="抗生素" name="tab_med">
                            <vxe-table :data.sync="medlist" :loading="tab_med_loading" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="auto" class="mytablestyle" highlight-current-row highlight-hover-column highlight-hover-row ref="tab_med_Table" show-overflow size="mini" stripe show-header-overflow :optimization="{animat: false}" resizable :edit-config="{trigger: 'click', mode: 'cell',showStatus:true}" header-align="center">
                                <vxe-table-column field="medname" title="抗生素名称" width="70px"></vxe-table-column>
                                <vxe-table-column field="medcode" title="英文代码" width="70px"></vxe-table-column>
                                <vxe-table-column field="whocode" title="whonet代码" width="140px" :edit-render="{name: 'input', autoselect:true, events: {change: hasChange}}">
                                    <template v-slot:edit="{ row,rowIndex,column}">
                                        <el-input v-model="row.whocode" @keyup.down.native="
															ResultMove(tab_name,row, 1, rowIndex,column.property)
														" @keyup.up.native="
															ResultMove(tab_name,row, 0, rowIndex,column.property)
														" @keyup.enter.native="
															ResultMove(tab_name,row, 2, rowIndex,column.property)
														" class="marrow-input" style="width:100%;height:100%;" @change="hasChange(row)"></el-input>

                                    </template>
                                    <template v-slot="{row}">
                                        <span>{{row.whocode=='' || row.whocode==null?'':row.whocode}}</span>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column field="whocode_mic" title="whonet代码（MIC）" width="140px" :edit-render="{name: 'input', autoselect:true}">
                                    <template v-slot:edit="{ row,rowIndex,column}">
                                        <el-input v-model="row.whocode_mic" @keyup.down.native="
															ResultMove(tab_name,row, 1, rowIndex,column.property)
														" @keyup.up.native="
															ResultMove(tab_name,row, 0, rowIndex,column.property)
														" @keyup.enter.native="
															ResultMove(tab_name,row, 2, rowIndex,column.property)
														" class="marrow-input" style="width:100%;height:100%;"></el-input>

                                    </template>
                                    <template v-slot="{row}">
                                        <span>{{row.whocode_mic=='' || row.whocode_mic==null?'':row.whocode_mic}}</span>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column field="whocode_kb" title="whonet代码（KB）" width="140px" :edit-render="{name: 'input', autoselect:true, events: {change: hasChange}}">
                                    <template v-slot:edit="{ row,rowIndex,column}">
                                        <el-input v-model="row.whocode_kb" @keyup.down.native="
															ResultMove(tab_name,row, 1, rowIndex,column.property)
														" @keyup.up.native="
															ResultMove(tab_name,row, 0, rowIndex,column.property)
														" @keyup.enter.native="
															ResultMove(tab_name,row, 2, rowIndex,column.property)
														" class="marrow-input" style="width:100%;height:100%;"></el-input>
                                    </template>
                                    <template v-slot="{row}">
                                        <span>{{row.whocode_kb=='' || row.whocode_kb==null?'':row.whocode_kb}}</span>
                                    </template>
                                </vxe-table-column>
                                <vxe-table-column field="whonetrescode" title="whonet耐药机制" width="140px" :edit-render="{name: 'input', autoselect:true}">
                                    <template v-slot:edit="{row}">
                                        <rm-selecttable ref="tablereqselect" :currentLable="row.label" showName="label" :tableColumnData="allReqsheetTable" :ftableDataList="whonetResistOption" :filterColumn="filterColumn" @change="whonetrescodechange($event, row)"></rm-selecttable>
                                    </template>
                                    <template v-slot="{row}">
                                        <span>{{row.whonetresname=='' || row.whonetresname==null?'':row.whonetresname+'('+row.whonetrescode+')'}}</span>
                                    </template>
                                </vxe-table-column>
                            </vxe-table>
                        </el-tab-pane>
                    </el-tabs>
                </div>
                <div style="position:relative;text-align:right;" class="dialog-footer" slot="footer">
                    <span>
                        <el-button @click="save()">保 存</el-button>
                        <el-button @click="CancelTips()">关 闭</el-button>
                    </span>
                </div>
            </el-dialog>
            <!--多选弹窗--->
            <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="multichktitle" :visible.sync="dialogMultipleVisible" :destroy-on-close="true">
                <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname" @change="closedialog"></rm-SqlMultiple>
            </el-dialog>
        </div>
    </div>
</template>

<script type="text/javascript">
import XEUtils from "xe-utils";
import axios from "axios";
import RmSelecttable from "@/components/rmcompents/rm_selecttable.vue";
export default {
    name: "LIS971",
    components: {
        RmSelecttable
    },
    data() {
        return {
            searchobj: {
                strdate: this.$pub.InitDate(),
                enddate: this.$pub.InitDate(),
                onlyposresult: 2,
                deletedup: 1,
                deptmode: "1",
                reqdept: '',
                txtwardno: '',
                pattype: '',
                germgramflag: '0',
                laboratory: "LIS",
            },
            sumcnt: 0,
            exportobj: {
                chksynr: "1",
                chksyns: "1",
            },
            leftTableData: [],
            rightTableData: [],
            url: "",
            showFile: false,
            leftloading: false,
            rightloading: false,
            is_showselother: false,
            bShowlogVisible: false,
            bDbfExportVisible: false,
            bMsgExportVisible: false,
            exportConditionVisible: false,
            topkey: 0,
            datename: "标本日期",
            datetype: "1",
            deptmodeOption: [
                { label: "", value: "" },
                { label: "科室", value: "1" },
                { label: "病区", value: "2" },
                { label: "科室_病区", value: "3" },
            ],
            fileList: [],
            rptArr: [],
            codeArr: [],
            logList: [],
            pattypeOption: [],
            deptOption: [],
            wardOption: [],
            hospOption: [],
            germcombOption: [],
            rptunitOption: [],
            specimenOption: [],
            doctorOption: [],
            userOption: [],
            instrOption: [],
            whonetextensionname: "",
            updata: { action: "LIB110" },
            exportdata: [],
            logListstr: "",
            searchtxt: "",
            onekeywhonet: true,
            tab_name: "tab_dept",
            execexport: false,
            stopexec: false,
            whonetdeptOption: [],
            whonetdepttypeOption: [],
            whonetspecimenOption: [],
            whonetResistOption: [],//WHONET耐药机制
            tab_dept_data: [],
            tab_ward_data: [],
            tab_spectype_data: [],
            tab_germ_data: [],
            tab_med_data: [],
            tab_dept_loading: false,
            tab_ward_loading: false,
            tab_spectype_loading: false,
            tab_germ_loading: false,
            tab_med_loading: false,
            whonetVisible: false,
            tab_showflag: "tab_dept",
            allReqsheetTable: [
                {
                    data: "label",
                    label: "名称",
                    width: "160",
                    // align: "center"
                },
                {
                    data: "value",
                    label: "code",
                    width: "60"
                },
            ],
            specallReqsheetTable: [
                {
                    data: "label",
                    label: "名称",
                    width: "160",
                    // align: "center"
                },
                {
                    data: "value",
                    label: "英文代码",
                    width: "60"
                },
                {
                    data: "value2",
                    label: "数字代码",
                    width: "60"
                },
            ],
            filterColumn: ["label", "value"],
            dialogMultipleVisible: false,
            multichktitle: '',
            fieldname: '',
            option1: [],
            option2: [],
            haveex: 0,
            DbfExportdefaultmsg:"确定使用系统默认格式导出吗？",
            DbfExportbtnname:"更新模板",
        };
    },
    created() {
        this.initOption();
        this.whonetOption();
    },
    computed: {
        rowcount() {
            return this.leftTableData.length;
        },
        //模糊查询  名称|首拼
        deptlist() {
            let txt = this.searchtxt.trim();
            if (txt) {
                let rest = this.tab_dept_data.filter((item) => {
                    return (
                        (item.deptname ? item.deptname.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false) ||
                        (item.inputcode ? item.inputcode.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false)
                    );
                });
                return rest;
            } else {
                return this.tab_dept_data;
            }
        },
        wardlist() {
            let txt = this.searchtxt.trim();
            if (txt) {
                let rest = this.tab_ward_data.filter((item) => {
                    return (
                        (item.wardname ? item.wardname.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false) ||
                        (item.inputcode ? item.inputcode.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false)
                    );
                });
                return rest;
            } else {
                return this.tab_ward_data;
            }
        },
        spectypelist() {
            let txt = this.searchtxt.trim();
            if (txt) {
                let rest = this.tab_spectype_data.filter((item) => {
                    return (
                        (item.specimen_code ? item.specimen_code.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false) ||
                        (item.specimen_name ? item.specimen_name.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false) ||
                        (item.inputcode ? item.inputcode.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false)
                    );
                })
                return rest;
            } else {
                return this.tab_spectype_data;
            }
        },
        medlist() {
            let txt = this.searchtxt.trim();
            if (txt) {
                let rest = this.tab_med_data.filter((item) => {
                    return (
                        (item.medcode ? item.medcode.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false) ||
                        (item.medname ? item.medname.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false) ||
                        (item.inputcode ? item.inputcode.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false)
                    );
                })
                return rest;
            } else {
                return this.tab_med_data;
            }
        },
        germlist() {
            let txt = this.searchtxt.trim();
            if (txt) {
                let rest = this.tab_germ_data.filter((item) => {
                    return (
                        (item.rpt_itemcode ? item.rpt_itemcode.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false) ||
                        (item.rpt_itemname ? item.rpt_itemname.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false) ||
                        (item.inputcode ? item.inputcode.toLowerCase().indexOf(txt.toLowerCase()) > -1 : false)
                    );
                })
                return rest;
            } else {
                return this.tab_germ_data;
            }
        },
    },
    mounted() {
        // this.init();
        this.url = this.$tool.baseUrl.replace(/api/, "z") + "fileupload";
        this.getDeptmode();
    },
    methods: {
        getDeptmode() {
            let deptmode = localStorage.getItem("lis971deptmode");
            if (deptmode) this.searchobj.deptmode = deptmode;
            let exportobj = JSON.parse(localStorage.getItem("lis971exportobj"));
            if (exportobj) this.exportobj = exportobj;
            let laboratory = localStorage.getItem("lis971laboratory");
            if (laboratory) this.searchobj.laboratory = laboratory;
        },
        popMultipleChk(e, fieldname, option, title) {
            let temp = XEUtils.clone(option, true);
            this.option1 = [];
            this.option2 = [];
            if (e != "") {
                let k = e.split(",");
                k.forEach((item) => {
                    let ndata = temp.find((m) => m.data == item);
                    if (ndata != undefined && ndata != null) {
                        this.option2.push(ndata);
                    }
                });
                temp.forEach((item) => {
                    if (k.indexOf(item.data + "") < 0) {
                        this.option1.push(item);
                    }
                });
            } else {
                this.option1 = temp;
            }
            this.fieldname = fieldname;
            this.multichktitle = title;
            this.dialogMultipleVisible = true;
        },
        closedialog(value, name) {
            if (value != "close") {
                this.searchobj[name] = value;
            }
            this.dialogMultipleVisible = false;
        },
        async whonetOption() {
            try {
                const res = await this.$tool.request({
                    url: "LIS/LIS9/LIS971",
                    method: "post",
                    data: {
                        action: "getwhonetOption",
                    },
                });
                this.whonetdeptOption = res.whonetdeptOption;
                this.whonetdepttypeOption = res.whonetdepttypeOption;
                this.whonetspecimenOption = res.whonetspecimenOption;
                this.whonetResistOption = res.whonetResistOption;
            } catch (e) {
                this.$message.warning(e);
            }
        },
        async initOption() {
            try {
                const res = await this.$tool.request({
                    url: "LIS/LIS9/LIS971",
                    method: "post",
                    data: {
                        action: "getOption",
                    },
                });

                this.pattypeOption = res.pattypeOption;
                this.deptOption = res.deptOption;
                this.hospOption = res.hospOption;
                this.doctorOption = res.doctorOption;
                this.rptunitOption = res.rptunitOption;
                // this.rptunitGroupOption = res.rptunitGroupOption;
                this.wardOption = res.wardOption;
                this.germcombOption = res.germcombOption;
                this.specimenOption = res.specimenOption;
                this.userOption = res.userOption;
                this.instrOption = res.instrOption;
                this.whonetextensionname = res.whonetextensionname;
            } catch (e) {
                this.$message.warning(e);
            }
        },
        BtnQuery() {
            this.execexport = false;
            this.leftloading = true;
            this.$tool
                .request({
                    url: "LIS/LIS9/LIS971",
                    method: "post",
                    data: {
                        action: "query",
                        daytype: this.datetype,
                        ...this.searchobj,
                    },
                })
                .then((response) => {
                    if (response.errcode == "1") {
                        this.leftTableData = response.Data;
                        if (response.Data.length > 0) {
                            this.$refs.leftxTable.setCurrentRow(this.leftTableData[0]);
                            this.queryRight(this.leftTableData[0]);
                            this.is_showselother = false;
                        } else {
                            this.leftTableData = [];
                            this.rightTableData = [];
                        }
                    } else {
                        this.$alert(response.errmsg, "提示");
                        this.leftTableData = [];
                        this.rightTableData = [];
                    }
                    this.leftloading = false;
                })
                .catch((e) => {
                    this.$alert(e, "出错");
                    this.leftloading = false;
                });
            localStorage.setItem("lis971deptmode", this.searchobj.deptmode); // 记录当前科室取值 本地
            localStorage.setItem("lis971laboratory", this.searchobj.laboratory); // 记录当前实验室代码 本地
            localStorage.setItem("lis971exportobj", JSON.stringify(this.exportobj));
        },
        currentChangeEvent({ row }) {
            this.queryRight(row);
        },
        queryRight(row) {
            this.rightloading = true;
            this.$tool
                .request({
                    url: "LIS/LIS9/LIS971",
                    method: "post",
                    data: {
                        action: "queryRight",
                        reportid: row.reportid,
                        rpt_itemcode: row.rpt_itemcode,
                    },
                })
                .then((response) => {
                    if (response.errcode == "1") {
                        this.rightTableData = response.MedData;
                    } else {
                        this.$alert(response.errmsg, "提示");
                    }
                    this.rightloading = false;
                })
                .catch((e) => {
                    this.$alert(e, "出错");
                    this.rightloading = false;
                });
        },
        BtnClear() {
            this.searchobj = {
                strdate: this.$pub.InitDate(),
                enddate: this.$pub.InitDate(),
                onlyposresult: 2,
                deletedup: 1,
                containHospcodeIsEmpty: "0",
                rejectGermComb: "0",
                reqdept: '',
                txtwardno: '',
                germgramflag: '0',
            };
            this.ExportConditionClear();
            this.leftTableData = [];
            this.rightTableData = [];
        },
        //tab页面
        tab_getdata(tab, event) {
            this.searchtxt = '';
            //切换页签自动保存
            if (this.tab_name != tab.name) {
                this.tabsave(this.tab_name);
                this.tab_name = tab.name;
            }
            if (tab.name == 'tab_germ' || tab.name == 'tab_med')
                this.onekeywhonet = false;
            else
                this.onekeywhonet = true;
            this.tabclickQuery();
        },
        tabsave(tab) {
            if (tab != '') {
                if (this.tab_name == "tab_dept") {
                    let data = this.$refs.tab_dept_Table.getUpdateRecords();
                    if (data.length > 0)
                        this.$tool
                            .request({
                                url: "LIS/LIS9/LIS971",
                                method: "post",
                                data: {
                                    action: "tabclickSave",
                                    tab: tab,
                                    data: data
                                },
                            })
                            .then((res) => {
                                if (res.flag == '1') {
                                    this.$message.success("保存成功！");
                                }
                                else
                                    this.$message.error("保存失败0！" + res.msg);
                            })
                            .catch((e) => {
                                this.$message.error("保存失败1！" + e);
                                console.log("error", e);
                            });
                } else if (this.tab_name == "tab_ward") {
                    let data = this.$refs.tab_ward_Table.getUpdateRecords();
                    if (data.length > 0)
                        this.$tool
                            .request({
                                url: "LIS/LIS9/LIS971",
                                method: "post",
                                data: {
                                    action: "tabclickSave",
                                    tab: tab,
                                    data: data
                                },
                            })
                            .then((res) => {
                                if (res.flag == '1') {
                                    this.$message.success("保存成功！");
                                }
                                else
                                    this.$message.error("保存失败0！" + res.msg);
                            })
                            .catch((e) => {
                                this.$message.error("保存失败1！" + e);
                                console.log("error", e);
                            });
                } else if (this.tab_name == "tab_spectype") {
                    let data = this.$refs.tab_spectype_Table.getUpdateRecords();
                    if (data.length > 0)
                        this.$tool
                            .request({
                                url: "LIS/LIS9/LIS971",
                                method: "post",
                                data: {
                                    action: "tabclickSave",
                                    tab: tab,
                                    data: data
                                },
                            })
                            .then((res) => {
                                if (res.flag == '1') {
                                    this.$message.success("保存成功！");
                                }
                                else
                                    this.$message.error("保存失败！" + res.msg);
                            })
                            .catch((e) => {
                                this.$message.error("保存失败！" + e);
                                console.log("error", e);
                            });
                } else if (this.tab_name == "tab_germ") {
                    let data = this.$refs.tab_germ_Table.getUpdateRecords();
                    if (data.length > 0)
                        this.$tool
                            .request({
                                url: "LIS/LIS9/LIS971",
                                method: "post",
                                data: {
                                    action: "tabclickSave",
                                    tab: tab,
                                    data: data
                                },
                            })
                            .then((res) => {
                                if (res.flag == '1') {
                                    this.$message.success("保存成功！");
                                }
                                else
                                    this.$message.error("保存失败！" + res.msg);
                            })
                            .catch((e) => {
                                this.$message.error("保存失败！" + e);
                                console.log("error", e);
                            });
                } else if (this.tab_name == "tab_med") {
                    let data = this.$refs.tab_med_Table.getUpdateRecords();
                    if (data.length > 0)
                        this.$tool
                            .request({
                                url: "LIS/LIS9/LIS971",
                                method: "post",
                                data: {
                                    action: "tabclickSave",
                                    tab: tab,
                                    data: data
                                },
                            })
                            .then((res) => {
                                if (res.flag == '1') {
                                    this.$message.success("保存成功！");
                                }
                                else
                                    this.$message.error("保存失败！" + res.msg);
                            })
                            .catch((e) => {
                                this.$message.error("保存失败！" + e);
                                console.log("error", e);
                            });
                }
            }
        },
        save() {
            if (this.tab_name == "tab_dept") {
                let data = this.$refs.tab_dept_Table.getUpdateRecords();
                if (data.length > 0)
                    this.$tool
                        .request({
                            url: "LIS/LIS9/LIS971",
                            method: "post",
                            data: {
                                action: "tabclickSave",
                                tab: this.tab_name,
                                data: data
                            },
                        })
                        .then((res) => {
                            if (res.flag == '1') {
                                this.$message.success("保存成功！");
                                this.tabclickQuery();
                            }
                            else
                                this.$message.error("保存失败0！" + res.msg);
                        })
                        .catch((e) => {
                            this.$message.error("保存失败1！" + e);
                            console.log("error", e);
                        });
            } else if (this.tab_name == "tab_ward") {
                let data = this.$refs.tab_ward_Table.getUpdateRecords();
                if (data.length > 0)
                    this.$tool
                        .request({
                            url: "LIS/LIS9/LIS971",
                            method: "post",
                            data: {
                                action: "tabclickSave",
                                tab: this.tab_name,
                                data: data
                            },
                        })
                        .then((res) => {
                            if (res.flag == '1') {
                                this.$message.success("保存成功！");
                                this.tabclickQuery();
                            }
                            else
                                this.$message.error("保存失败0！" + res.msg);
                        })
                        .catch((e) => {
                            this.$message.error("保存失败1！" + e);
                            console.log("error", e);
                        });
            } else if (this.tab_name == "tab_spectype") {
                let data = this.$refs.tab_spectype_Table.getUpdateRecords();
                if (data.length > 0)
                    this.$tool
                        .request({
                            url: "LIS/LIS9/LIS971",
                            method: "post",
                            data: {
                                action: "tabclickSave",
                                tab: this.tab_name,
                                data: data
                            },
                        })
                        .then((res) => {
                            if (res.flag == '1') {
                                this.$message.success("保存成功！");
                                this.tabclickQuery();
                            }
                            else
                                this.$message.error("保存失败！" + res.msg);
                        })
                        .catch((e) => {
                            this.$message.error("保存失败！" + e);
                            console.log("error", e);
                        });
            } else if (this.tab_name == "tab_germ") {
                let data = this.$refs.tab_germ_Table.getUpdateRecords();
                if (data.length > 0)
                    this.$tool
                        .request({
                            url: "LIS/LIS9/LIS971",
                            method: "post",
                            data: {
                                action: "tabclickSave",
                                tab: this.tab_name,
                                data: data
                            },
                        })
                        .then((res) => {
                            if (res.flag == '1') {
                                this.$message.success("保存成功！");
                                this.tabclickQuery();
                            }
                            else
                                this.$message.error("保存失败！" + res.msg);
                        })
                        .catch((e) => {
                            this.$message.error("保存失败！" + e);
                            console.log("error", e);
                        });
            } else if (this.tab_name == "tab_med") {
                let data = this.$refs.tab_med_Table.getUpdateRecords();
                if (data.length > 0)
                    this.$tool
                        .request({
                            url: "LIS/LIS9/LIS971",
                            method: "post",
                            data: {
                                action: "tabclickSave",
                                tab: this.tab_name,
                                data: data
                            },
                        })
                        .then((res) => {
                            if (res.flag == '1') {
                                this.$message.success("保存成功！");
                                this.tabclickQuery();
                            }
                            else
                                this.$message.error("保存失败！" + res.msg);
                        })
                        .catch((e) => {
                            this.$message.error("保存失败！" + e);
                            console.log("error", e);
                        });
            }
        },
        tabclickQuery() {
            if (this.tab_name == "tab_dept") {
                this.tab_dept_loading = true;
                this.$tool
                    .request({
                        url: "LIS/LIS9/LIS971",
                        method: "post",
                        data: {
                            action: "getwhonetlist",
                            tab: this.tab_name
                        },
                    })
                    .then((res) => {
                        this.tab_dept_data = res.data;
                        this.tab_dept_loading = false;
                    })
                    .catch((e) => {
                        this.tab_dept_loading = false;
                        this.tab_spectype_loading = false;
                        this.tab_germ_loading = false;
                        this.tab_med_loading = false;
                        console.log("error", e);
                    });
            } else if (this.tab_name == "tab_ward") {
                this.tab_ward_loading = true;
                this.$tool
                    .request({
                        url: "LIS/LIS9/LIS971",
                        method: "post",
                        data: {
                            action: "getwhonetlist",
                            tab: this.tab_name
                        },
                    })
                    .then((res) => {
                        this.tab_ward_data = res.data;
                        this.tab_ward_loading = false;
                    })
                    .catch((e) => {
                        this.tab_ward_loading = false;
                        console.log("error", e);
                    });
            } else if (this.tab_name == "tab_spectype") {
                this.tab_spectype_loading = true;
                this.$tool
                    .request({
                        url: "LIS/LIS9/LIS971",
                        method: "post",
                        data: {
                            action: "getwhonetlist",
                            tab: this.tab_name
                        },
                    })
                    .then((res) => {
                        this.tab_spectype_data = res.data;
                        this.tab_spectype_loading = false;
                    })
                    .catch((e) => {
                        this.tab_spectype_loading = false;
                        console.log("error", e);
                    });
            } else if (this.tab_name == "tab_germ") {
                this.tab_germ_loading = true;
                this.$tool
                    .request({
                        url: "LIS/LIS9/LIS971",
                        method: "post",
                        data: {
                            action: "getwhonetlist",
                            tab: this.tab_name
                        },
                    })
                    .then((res) => {
                        this.tab_germ_data = res.data;
                        this.tab_germ_loading = false;
                    })
                    .catch((e) => {
                        this.tab_germ_loading = false;
                        console.log("error", e);
                    });
            } else if (this.tab_name == "tab_med") {
                this.tab_med_loading = true;
                this.$tool
                    .request({
                        url: "LIS/LIS9/LIS971",
                        method: "post",
                        data: {
                            action: "getwhonetlist",
                            tab: this.tab_name
                        },
                    })
                    .then((res) => {
                        this.tab_med_data = res.data;
                        this.tab_med_loading = false;
                    })
                    .catch((e) => {
                        this.tab_med_loading = false;
                        console.log("error", e);
                    });
            }
        },
        //单元格编辑框上下键事件
        //type 1下，0上，2回车
        ResultMove(tab_name, row, type, index, coltype) {
            if (tab_name == 'tab_med')
                if (type == 1) {
                    //下
                    var row = this.$refs.tab_med_Table.tableFullData[index + 1];
                    this.$refs.tab_med_Table.setCurrentRow(row);
                    this.$refs.tab_med_Table.setActiveCell(row, coltype);
                } else if (type == 0) {
                    //上
                    if (index != 0) {
                        var row = this.$refs.tab_med_Table.tableFullData[index - 1];
                        this.$refs.tab_med_Table.setCurrentRow(row);
                        this.$refs.tab_med_Table.setActiveCell(row, coltype);
                    }
                } else {
                    //回车
                    var row = this.$refs.tab_med_Table.tableFullData[index + 1];
                    this.$refs.tab_med_Table.setCurrentRow(row);
                    this.$refs.tab_med_Table.setActiveCell(row, coltype);
                }
            else if (tab_name == 'tab_germ')
                if (type == 1) {
                    //下
                    var row = this.$refs.tab_germ_Table.tableFullData[index + 1];
                    this.$refs.tab_germ_Table.setCurrentRow(row);
                    this.$refs.tab_germ_Table.setActiveCell(row, coltype);
                } else if (type == 0) {
                    //上
                    if (index != 0) {
                        var row = this.$refs.tab_germ_Table.tableFullData[index - 1];
                        this.$refs.tab_germ_Table.setCurrentRow(row);
                        this.$refs.tab_germ_Table.setActiveCell(row, coltype);
                    }
                } else {
                    //回车
                    var row = this.$refs.tab_germ_Table.tableFullData[index + 1];
                    this.$refs.tab_germ_Table.setCurrentRow(row);
                    this.$refs.tab_germ_Table.setActiveCell(row, coltype);
                }
        },
        CancelTips() {
            this.whonetVisible = false;
        },
        getwhonetcheck() {
            this.whonetVisible = true;
            if (this.tab_name == "tab_dept") {
                this.tab_dept_loading = true;

                this.$tool
                    .request({
                        url: "LIS/LIS9/LIS971",
                        method: "post",
                        data: {
                            action: "getwhonetlist",
                            tab: this.tab_name
                        },
                    })
                    .then((res) => {
                        this.tab_dept_data = res.data;
                        this.tab_dept_loading = false;
                    })
                    .catch((e) => {
                        this.tab_dept_loading = false;
                        console.log("error", e);
                    });
            }
        },
        hasChange(row) {
            if (row.whocode != '' && (row.whocode_kb == '' || row.whocode_kb == null))
                row.whocode_kb = row.whocode + '_ND';
            else if (row.whocode != '' && row.whocode_kb != '' && row.whocode_kb.indexOf("_") != -1)
                row.whocode_kb = row.whocode + row.whocode_kb.substr(row.whocode_kb.indexOf("_"));
            if (row.whocode != '' && (row.whocode_mic == '' || row.whocode_mic == null))
                row.whocode_mic = row.whocode + '_NM';
            else if (row.whocode != '' && row.whocode_mic != '' && row.whocode_mic.indexOf("_") != -1)
                row.whocode_mic = row.whocode + row.whocode_mic.substr(row.whocode_mic.indexOf("_"));
        },
        changewhonet(val) {
            if (val == '1') {
                if (this.tab_name == "tab_germ") {
                    this.tab_germ_data.forEach((item) => {
                        item.germwhocode = item.itemcode_en;
                    });
                } else if (this.tab_name == "tab_med") {
                    this.tab_med_data.forEach((item) => {
                        item.whocode = item.medcode;
                        item.whocode_kb = item.medcode + '_ND';
                        item.whocode_mic = item.medcode + '_NM';
                    });
                }
            }
            else {
                if (this.tab_name == "tab_germ") {
                    this.tab_germ_data.forEach((item) => {
                        if (!item.germwhocode)
                            item.germwhocode = item.itemcode_en;
                    });
                } else if (this.tab_name == "tab_med") {
                    this.tab_med_data.forEach((item) => {
                        if (!item.whocode) {
                            item.whocode = item.medcode;
                            item.whocode_kb = item.medcode + '_ND';
                            item.whocode_mic = item.medcode + '_NM';
                        }
                    });
                }
            }
        },
        whonetrescodechange(selectrow, row) {
            if (!selectrow) {
                row.whonetrescode = "";
                row.whonetresname = "";
                return false;
            }
            row.whonetrescode = selectrow.value;
            row.whonetresname = selectrow.label;
        },
        specimenchangewhocode(selectrow, row) {
            console.log(selectrow)
            if (!selectrow) {
                row.whocode = "";
                row.whona = "";
                row.whocodename = "";
                return false;
            }
            row.whocode = selectrow.value;
            row.whona = selectrow.value2;
            row.whocodename = selectrow.label;
        },
        deptchangewhocode(selectrow, row) {
            if (!selectrow) {
                row.whocode = "";
                row.whocodename = "";
                return false;
            }
            row.whocode = selectrow.value;
            row.whocodename = selectrow.label;
        },
        deptkindchangewhocode(selectrow, row) {
            if (!selectrow) {
                row.whokind = "";
                row.whokindname = "";
                return false;
            }
            row.whokind = selectrow.value;
            row.whokindname = selectrow.label;
        },
        BtnSort() { },
        async BtnExport() {
            let data = this.$refs.leftxTable.getSelectRecords();
            if (data.length > 0) {
                let rloading = this.$loading({
                    // 声明一个loading对象
                    lock: true, // 是否锁屏
                    text: "开始导出数据，请稍等！", // 加载动画的文字
                    spinner: "el-icon-loading", // 引入的loading图标
                    background: "rgba(0, 0, 0, 0.3)", // 背景颜色
                    target: ".sub-main", // 需要遮罩的区域
                    body: true,
                    customClass: "mask" // 遮罩层新增类名
                });
                try{
                    let reportidVsrpt_itemcode = "";
                    data.forEach((item) => {
                        let tempstr = item.reportid + "," + item.rpt_itemcode;
                        reportidVsrpt_itemcode += tempstr + "|";
                    });
                    let filename = "WhonetData_" + this.searchobj.strdate + "_" + this.searchobj.enddate;
                    let p = { prgno: "LIS971", filename: filename, reportidVsrpt_itemcode: reportidVsrpt_itemcode, deptmode: this.searchobj.deptmode, ...this.exportobj };
                    await this.$pub.commexport(this, p, filename + ".zip", "text/html;charset=gb2312");
                    rloading.close();
                }
                catch(e){
                    rloading.close();
                }
            } else {
                this.$alert("请选择需要导出的数据！", "提示");
            }
        },
        SelArr() {
            this.sumcnt = 0;
            let data = this.$refs.leftxTable.getSelectRecords();
            this.sumcnt = this.$refs.leftxTable.getSelectRecords().length;
            this.rptArr = "";
            this.codeArr = "";
            data.forEach((element) => {
                this.rptArr += ",'" + element.reportid + "'";
                this.codeArr += ",'" + element.rpt_itemcode + "'";
            });
            this.rptArr = this.rptArr.substring(1, this.rptArr.length);
            this.codeArr = this.codeArr.substring(1, this.codeArr.length);
        },
        BtnDbf() {
            //先去服务器查询是否存在模板DBF文件,
            //若存在 返回1,提示是否要上传覆盖,
            //若不存在 返回2,直接进入上传界面.
            let data = this.$refs.leftxTable.getSelectRecords();
            if (data.length > 0) {
                this.BtnQueryEx();
            } else {
                this.$alert("请选择需要导出的数据！", "提示");
                return false;
            }
        },
        BtnQueryEx() {
            this.$tool
                .request({
                    url: "LIS/LIS9/LIS971",
                    method: "post",
                    data: {
                        action: "haveex",
                    },
                })
                .then((res) => {
                    if (res == "1") {
                        this.haveex = 1;
                        this.DbfExportdefaultmsg="确定使用当前模板进行导出吗？";
                        this.DbfExportbtnname="更新模板";
                        this.bMsgExportVisible = true;
                    } else {
                        this.haveex = 0;
                        this.DbfExportdefaultmsg="确定使用系统默认格式导出吗？";
                        this.DbfExportbtnname="上传模板";
                        this.bMsgExportVisible=true;
                        //this.bDbfExportVisible = true;
                    }
                })
                .catch((e) => {
                    console.log("error", e);
                });
        },
        BtnDBFExport() {
            this.logList = [];
            this.logListstr = "";
            this.exportdata = [];
            this.exportdata = this.$refs.leftxTable.getSelectRecords();
            var list=[];
            if (this.exportdata.length > 0) {
                for(let i=0;i<this.exportdata.length;i++){
                    var item=this.exportdata[i];
                    var itemreportid=item.reportid;
                    var itemrpt_itemcode=item.rpt_itemcode;
                    var litem={itemreportid:itemreportid,itemrpt_itemcode:itemrpt_itemcode}
                    list.push(litem);
                }
                //既然是创建了消息LIST，就干脆一条一条的来
                this.bDbfExportVisible = false;
                this.bMsgExportVisible = false;
                // this.bShowlogVisible = true;
                this.execexport = true;
                this.stopexec = false;
                this.logListstr += "开始后台生成DBF文件！<br/>"
                // this.logList.push("开始后台生成DBF文件！");
                // this.logList.push("共  " + this.exportdata.length + "  条数据");
                // this.logList.push("");
                this.execDbfExport("", 0,list);
            } else {
                this.$alert("请选择需要导出的数据！", "提示");
            }
        },
        execDbfExport(dbfname, index,list) {
            // if(this.bShowlogVisible==false) return ;//关闭了导出消息框则终止调用
            if (this.stopexec) return;//人为中止
            if (index < this.exportdata.length) {
                let item = this.exportdata[index];
                this.$tool
                    .request({
                        url: "LIS/LIS9/LIS971",
                        method: "post",
                        data: {
                            action: "dbfexportnew",
                            list:list,
                            ...this.exportobj,
                            dbfname: dbfname,
                            reportid: item.reportid,
                            rpt_itemcode: item.rpt_itemcode,
                            deptmode: localStorage.getItem("lis971deptmode"),
                            laboratory: localStorage.getItem("lis971laboratory"),
                            haveex: this.haveex,
                        },
                    })
                    .then((res) => {
                        if (res.errcode == "0") {
                            this.logListstr += "文件生成过程中发生错误：" + res.errmsg + "<br/>"
                        } else {
                            var list=[];
                            this.execDbfExport(res.dbfname, index + 1,list);
                            if (res.showmsg && res.showmsg.length > 0) {
                                let sstr = "";
                                res.showmsg.forEach((txt) => {
                                    if (sstr == "") sstr = txt;
                                    else sstr = sstr + "<br/>" + txt;
                                });
                                // this.logList.push(sstr);
                                this.logListstr += sstr
                            }
                            this.logListstr += "导出第  " + (index + 1) + " 条数据完成<br/>"
                            // this.logList.push("导出第  " + (index + 1) + " 条数据完成");
                        }
                    })
                    .catch((e) => {
                        // this.logList.push("文件生成过程中发生异常：" + e);
                        this.logListstr += "文件生成过程中发生异常：" + e.message + "<br/>"
                    });
            } else {
                //全部导完了
                this.logListstr += "后台数据生成结束！<br/>开始下载后台文件<br/>"
                // this.logList[this.logList.length - 1] = "后台数据生成结束！";
                // this.logList.push("开始下载后台文件");
                console.log("dbfname", dbfname);
                //一般一个月导一次，文件名默认月先
                let filename = this.searchobj.strdate.substring(0, 7).replace('-', '') + '.' + (this.whonetextensionname ? this.whonetextensionname : 'LIS');
                let p = { prgno: "LIS971_DBF", dbfname: dbfname, filename: filename };
                this.$pub.commexport(this, p, filename).then(() => {
                    this.logListstr += "文件下载结束！<br/>"
                    //  this.logList.push("文件下载结束");
                    setTimeout(() => {
                        this.DelExport(dbfname);
                    }, 100);
                }).catch(() => {
                    this.logListstr += "文件下载出错！<br/>"
                    //  this.logList.push("文件下载出错");
                });
            }
        },
        stopexport() {
            this.stopexec = true;
        },
        DelExport(dbfname) {
            this.$tool
                .request({
                    url: "LIS/LIS9/LIS971",
                    method: "post",
                    data: {
                        action: "delexport",
                        dbfname: dbfname,
                    },
                })
                .then((res) => {
                    if (res.delflag == "1") {
                        this.logListstr += "清除服务器临时文件完成<br/>本次导出结束！<br/>"
                        // this.logList.push("清除服务器临时文件");
                        // this.logList.push("本次导出结束");
                    } else {
                        this.logListstr += "清除服务器临时文件出错" + res.delmsg + "<br/>本次导出结束！<br/>"
                        //  this.logList.push(res.delmsg);
                    }
                })
                .catch((e) => { });
        },
        btn_showselother() {
            this.is_showselother = !this.is_showselother;
        },
        handleCommand(name) {
            this.datename = name;
            if (name == "标本日期") {
                this.datetype = "1";
            } else {
                this.datetype = "2";
            }
        },
        ExportConditionSure() {
            this.exportConditionVisible = false;
        },
        ExportConditionClear() {
            this.exportobj = {
                PatnoShowPatid: "0",
                delCopySample: "0",
                micIsEmptyNouseResultFlag: "0",
                OnlyMicNotEmpty: "0",
                radIsEmptyNouseResultFlag: "0",
                OnlyRadNotEmpty: "0",
                chkdayu: "0",
                chkxiaoyu: "0",
                chkdayudengyu: "0",
                chkxiaoyudengyu: "0",
                chksynr: "1",
                chksyns: "1",
                slashformula:"",
            };
        },
        formatFun({ cellValue, column, row }) {
            if (["hospcode", "hospitalcode"].includes(column.property)) {
                try {
                    if (cellValue.toLowerCase() == "all") {
                        return "全部医院";
                    } else {
                        let hospname = this.hospOption.find((m) => m.data == cellValue);
                        if (hospname != undefined && hospname != null) {
                            return hospname.display;
                        } else {
                            return cellValue;
                        }
                    }
                } catch { }
            } else if (["req_deptno"].includes(column.property)) {
                try {
                    let deptname = this.deptOption.find((m) => m.data == cellValue);
                    if (deptname != undefined && deptname != null) {
                        return deptname.display;
                    } else {
                        return cellValue;
                    }
                } catch { }
            } else if (["req_wardno"].includes(column.property)) {
                try {
                    let wardname = this.wardOption.find((m) => m.data == cellValue);
                    if (wardname != undefined && wardname != null) {
                        return wardname.display;
                    } else {
                        return cellValue;
                    }
                } catch { }
            } else if (column.property == "pat_typecode") {
                try {
                    let pattypename = this.pattypeOption.find((m) => m.data == cellValue);
                    if (pattypename != undefined && pattypename != null) {
                        return pattypename.display;
                    } else {
                        return cellValue;
                    }
                } catch { }
            } else if (["req_docno"].includes(column.property)) {
                //申请医生
                try {
                    let doctorname = this.doctorOption.find((m) => m.data == cellValue);
                    if (doctorname != undefined && doctorname != null) {
                        return doctorname.display;
                    } else {
                        return cellValue;
                    }
                } catch { }
            } else if (["rechk_user", "rechk2_user", "report_user"].includes(column.property)) {
                //检验医生，审核医生
                try {
                    let username = this.userOption.find((m) => m.data == cellValue);
                    if (username != undefined && username != null) {
                        return username.display;
                    } else {
                        return cellValue;
                    }
                } catch { }
            } else if (column.property == "rptunitid") {
                try {
                    let rptunitname = this.rptunitOption.find((m) => m.data == cellValue);
                    if (rptunitname != undefined && rptunitname != null) {
                        return rptunitname.display + "[" + cellValue + "]";
                    } else {
                        return cellValue;
                    }
                } catch { }
            } else if (column.property == "specimen_code") {
                try {
                    let specimenname = this.specimenOption.find((m) => m.data == cellValue);
                    if (specimenname != undefined && specimenname != null) {
                        return specimenname.display;
                    } else {
                        return cellValue;
                    }
                } catch {
                    return cellValue;
                }
            } else if (column.property == "charge_flag") {
                try {
                    let rptunitname = this.chargeflagOption.find((m) => m.value == cellValue);
                    if (rptunitname != undefined && rptunitname != null) {
                        return rptunitname.label;
                    } else {
                        return cellValue;
                    }
                } catch { }
            } else if (column.property == "instrid") {
                try {
                    let instr = this.instrOption.find((m) => m.data == cellValue);
                    if (instr != undefined && instr != null) {
                        console.log(instr.display);
                        return instr.display;
                    } else {
                        return cellValue;
                    }
                } catch {
                    return cellValue;
                }
            } else {
                return cellValue;
            }
        },
        CellActive({ row, column }) {
            return false;
        },

        handleExceed(files, fileList) {
            this.$message.warning(`当前限制选择 1 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
        },
        // 上传文件之前的钩子, 参数为上传的文件,若返回 false 或者返回 Promise 且被 reject，则停止上传
        beforeUploadFile(file) {
            console.log(file);
            let extension = file.name.substring(file.name.lastIndexOf(".") + 1);
            console.log("extension", extension);
            let size = file.size / 1024 / 1024;
            if (extension != "DBF") {
                this.$notify.warning({
                    title: "警告",
                    message: `只能上传DBF(*DBF)文件`,
                });
                return false;
            }
        },
        uploadOpt(param) {
            var URL = this.$tool.baseUrl.replace("api", "z") + "fileupload";
            let formData = new FormData();
            formData.append("action", "LIS971");
            formData.append("file", param.file);
            axios
                .post(URL, formData, { "Content-Type": "multipart/form-data" })
                .then((res) => {
                    this.$message({
                        message: "上传模板成功。",
                        type: "success",
                    });
                    // setTimeout(() => {
                    //     // this.BtnDBFExport();
                    // }, 60);
                    this.bDbfExportVisible = false;
                    this.bMsgExportVisible = true;
                    this.DbfExportbtnname="更新模板";
                    this.DbfExportdefaultmsg="确定使用当前模板进行导出吗？";
                })
                .catch((e) => {
                    this.$alert(e, "出错");
                });
        },
    }
};
</script>

<style scoped>
.pagetop {
    width: 100%;
    height: 68px;
    display: -webkit-box;
    -webkit-box-pack: left;
    -webkit-box-align: center;
    border: 1px solid #ccc;
    position: absolute;
    z-index: 99;
}
.diapagetop {
    width: 100%;
    height: 35px;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-box-pack: left;
    -webkit-box-align: center;
    border: 1px solid #ccc;
    z-index: 99;
}
.pagetopother {
    width: 100%;
    height: 158px;
    display: -webkit-box;
    -webkit-box-pack: left;
    -webkit-box-align: center;
    border: 1px solid #ccc;
    position: absolute;
    z-index: 99;
}
.pagecenter {
    position: absolute;
    top: 73px;
    width: 100%;
    left: 0;
    bottom: 0px;
    overflow: auto;
}
.pagecenterother {
    position: absolute;
    top: 163px;
    width: 100%;
    left: 0;
    bottom: 0px;
    overflow: auto;
}
.operation-list {
    float: right;
    margin-right: 5px;
    margin-bottom: 5px;
}
table {
    font-size: 12px;
    border-collapse: separate;
    border-spacing: 5px;
}
.el-input--suffix .el-input__inner {
    padding-right: 0px;
}
.search-param {
    display: inline-block;
}
.table1style tr td {
    padding: 0px 2px 0px 5px;
}
::-webkit-scrollbar {
    width: 0px;
    height: 5px;
    border: 4px solid white;
}
::-webkit-scrollbar-thumb {
    background-color: #c1c1c1;
}
::-webkit-scrollbar-track {
    background-color: #f1f1f1;
}
/* Buttons */
::-webkit-scrollbar-button:single-button {
    background-color: #bbbbbb;
    display: block;
    border-style: solid;
    height: 5px;
    width: 5px;
}
/* Left */
::-webkit-scrollbar-button:horizontal:decrement {
    margin-right: 2px;
    border-width: 4px 4px 4px 0;
    border-color: #f1f1f1 transparent #f1f1f1 #f1f1f1;
    background-color: #000000;
}
::-webkit-scrollbar-button:horizontal:decrement:hover {
    border-color: #d2d2d2 transparent #d2d2d2 #d2d2d2;
}
/* Right */
::-webkit-scrollbar-button:horizontal:increment {
    margin-left: 2px;
    border-width: 4px 0 4px 4px;
    border-color: #f1f1f1 #f1f1f1 #f1f1f1 transparent;
    background-color: #000000;
}
::-webkit-scrollbar-button:horizontal:increment:hover {
    border-color: #d2d2d2 #d2d2d2 #d2d2d2 transparent;
}
</style>
